﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace NCEdu.Web.ClassCommittee
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
				{
					int ClassId=(Convert.ToInt32(Request.Params["id"]));
					ShowInfo(ClassId);
				}
			}
		}
			
	private void ShowInfo(int ClassId)
	{
		NCEdu.BLL.ClassCommittee bll=new NCEdu.BLL.ClassCommittee();
		NCEdu.Model.ClassCommittee model=bll.GetModel(ClassId);
		this.lblClassId.Text=model.ClassId.ToString();
		this.txtClassCommitteeName.Text=model.ClassCommitteeName;
		this.txtClassCommitteeDes.Text=model.ClassCommitteeDes;

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtClassCommitteeName.Text.Trim().Length==0)
			{
				strErr+="ClassCommitteeName不能为空！\\n";	
			}
			if(this.txtClassCommitteeDes.Text.Trim().Length==0)
			{
				strErr+="ClassCommitteeDes不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int ClassId=int.Parse(this.lblClassId.Text);
			string ClassCommitteeName=this.txtClassCommitteeName.Text;
			string ClassCommitteeDes=this.txtClassCommitteeDes.Text;


			NCEdu.Model.ClassCommittee model=new NCEdu.Model.ClassCommittee();
			model.ClassId=ClassId;
			model.ClassCommitteeName=ClassCommitteeName;
			model.ClassCommitteeDes=ClassCommitteeDes;

			NCEdu.BLL.ClassCommittee bll=new NCEdu.BLL.ClassCommittee();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
